package com.supeng.PMdepot.service;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.util.Log;

/**
 * Created by Supeng on 2018/8/23.
 */

public class DemoService extends Service{
    private  MyBinder myBinder=new MyBinder();
    @Override
    public void onCreate() {
        super.onCreate();
        Log.i("DemoService","onCreate");
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.i("DemoService","onStartCommand");
        return super.onStartCommand(intent, flags, startId);
    }

    @Override
    public void onDestroy() {
        Log.i("DemoService","onDestroy");
        super.onDestroy();
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return myBinder;
    }
   public class MyBinder extends Binder{
        Thread myThread;
        public void doLoad(){
            myThread=new Thread(new Runnable(){
                @Override
                public void run() {
                    Log.i("DemoService","DemoService--doload");
                }
            });
            myThread.start();
        }
    }
}
